package com.itheima.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.entity.Result;
import com.itheima.pojo.Role;
import com.itheima.service.RoleService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version v1.0
 * @author： 邱敏
 * @date： 2020/2/11 16:32
 * @description：
 */
@RestController
@RequestMapping("/role")
public class RoleController {

    @Reference(cluster = "failfast")
    private RoleService roleService;


    @RequestMapping("findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return roleService.findPage(queryPageBean);
    }

    @RequestMapping("findMenuAndPermission")
    public Result findMenuAndPermission(){
        return roleService.findMenuAndPermission();
    }

    @RequestMapping("add")
    public Result add(@RequestBody Role role){
        return roleService.add(role);
    }

    @RequestMapping("findById")
    public Result findById(Integer id){
        return roleService.findById(id);
    }

    @RequestMapping("edit")
    public Result edit(@RequestBody Role role){
        return roleService.edit(role);
    }

    @RequestMapping("delete")
    public Result delete(Integer id){
        return roleService.delete(id);
    }


}
